<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>首页</title>  
<link rel="stylesheet" type="text/css" href="css/index.css">
<link rel="shortcut icon" type="text/css" href="images/favicon.ico"/>
<script src="js/jquery-1.11.3.min.js"></script>
<script src="js/index.js"></script>
<script>
$(function(){
	$("#myli").mouseover(function(){
		$("#myspan").css("display","block");
		$("#current_userInfo").css("display","block");
	});
	
	$("#myli").mouseout(function(){
		$("#myspan").css("display","none");
		$("#current_userInfo").css("display","none");
	});
	
}); 

function article(aid){
	$.post("json/articleAction_getOneArticle",{'article.aid':aid},function(data){
		if(data.result==1){
			location.href="article/oneArticle.jsp?aid="+aid;
		}else if(data.result==0){
			alert("找不到...");
		}
	});
}

//function test(tid){
	//$.post("testServlet",{op:"getOneTest",tid:tid},function(data){
		//data=parseInt($.trim(data));
		//if(data==1){
		//	location.href="test/teststart.jsp?tid="+tid;
		//}else if(data==0){
		//	alert("找不到...");
		//}
//	});
//}

function fm(fid){
	$.post("json/FmArticleAction_fmData?t="+new Date(),{'fid':fid},function(data){
		location.href="FM/FM_mentality.jsp";
	});
}

function mood(mid){
	$.post("json/moodsAction_seeOneMood",{"mood.mid":mid},function(data){
		if(data.result > 0) {
			location.href="moods/commentMood.jsp";
		}else{
			alert("系统错误!");
		}
	});
}

</script>
</head>
<body>
<!--头部开始-->
<div class="header">
    <div class="logo">
        <a href="index.jsp"><img src="images/logo.png"></a>
    </div>
    <div class="nav">
        <ul>
            <li><a href="index.jsp" class="tit">首页</a></li>
            <li><a href="javaScript:getInfo()" class="tit">心理FM</a></li>
            <li><a href="moods/moods.jsp" class="tit">心情说</a></li>
            <li><a href="javaScript:getArticleInfo()" class="tit">杂志</a></li>
            <li><a href="#" class="tit">测试</a></li>
            <li><a href="smile/smile.jsp" class="tit">微笑墙</a></li>
        </ul>
    </div>
    <div class="reg">
        <ul>
        	<c:if test="${empty sessionScope.currentUser}">
	            <li><a href="login/login.html" id="login_logo">登录</a></li>
	            <li><span class="line"></span></li>
	            <li><a href="reg/reg.html" id="reg_logo">注册</a></li>
	       	</c:if>
	       	<c:if test="${!empty sessionScope.currentUser}">
	       		<li id="myli"><span>欢迎您</span>[<a href="userServlet?op=getPerInfo" style="color:yellow;font-size:12px;" id="user_email">${sessionScope.currentUser.w_email}</a>] 
	       		<span id="myspan"></span>
	       		<div id="current_userInfo">
	       			<dl>
	       				<dd><a href="moods/per.jsp">个人中心</a></dd>
	       				<dd><a href="moods/publish.jsp">发表说说</a></dd>
	       				<dd><a href="#">我的通知</a></dd>
	       				<dd><a href="exit.jsp">退&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;出</a></dd>
	       			</dl>
	       		</div>
	       		</li>
	       	</c:if>
        </ul>
    </div>
    <div class="sear">
        <form target="_blank" action="" method="get">
            <input type="text" class="text" name="sear" placeholder="搜索" />
            <input type="submit" class="submit" value="&#10140;"/>
        </form>
    </div>
</div>
<!--头部结束-->
<!--临时广告位 -->
<div id="mycontent">
    <div class="ad" style="margin-bottom: -15px;">
        <a target="_blank" href="#" class="ad_a">
            <img src="images/ad_1.jpg"/>
       	</a>
    </div>
</div>  
<!--临时广告位结束-->
<!--内容部分开始-->
<div id="main" >
    <div id="left">
     	<div id="picShow">
        	<div id="left_pic_right">
            	<a href="#" id="pic_left"></a>
                <a href="#" id="pic_right"></a>
            </div>
            <div id="slide">
                <ul id="pic_ul">
                <c:forEach items="${articleInfo}" var="item" begin="0" end="2">
                    <li id="pic_li">
                        <div class="picShow_img">
                            <img src="${item.aaddr}"/>
                        </div>
                        <div id="pic_title">
                            <a href="javascript:article(${item.aid})">${item.aname}</a>
                        </div>
                    </li>
                 </c:forEach>
                     <li>
                        <div class="picShow_img">
                            <img src="images/slide_img_3.jpg"/>
                        </div>
                        <div id="pic_title">
                            <a href="#">2015年年度最佳心理书籍100本</a>
                        </div>
                    </li>
                    <li>
                        <div class="picShow_img">
                            <img src="images/slide_img_2.jpg"/>
                        </div>
                        <div id="pic_title">
                            <a href="#">2015年年度最佳心理书籍100本</a>
                        </div>
                    </li>
                </ul>
            </div>
          	<div id="index_pic_dian">
                <a href="#" class="dian_style_1"></a>
                <a href="#"></a>
                <a href="#"></a>
            </div>
        </div>
        <div id="newArticle">
        	<div id="newArticle_head">
            	<h1>最新推荐</h1>
            </div>
            <div id="newArticle_body">
            	<ul>
            	<!--<c:forEach items="${articleInfo}" var="item" begin="0" end="4">
                   <li><a href="javascript:article(${item.aid})">${item.aname}</a></li>
                </c:forEach>-->
                   <li><a href="#" target="_blank">为什么我总不能与人深入交往？</a></li>
                   <li><a href="#" target="_blank">生命中，什么是努力也补不回来的？</a></li>
                   <li><a href="#" target="_blank">告别你充满控制的人生</a></li>
                   <li><a href="#" target="_blank">优秀的人为何高发抑郁？</a></li>
                </ul>
            </div>
        </div>
        <div id="showArticle">
        	<div id="showArticle_head">
            	<h2>看文章</h2>
               
            </div>
            <div id="showArticle_body">
            	<ul>
            		<c:forEach items="${articleInfo}" var="item" begin="0" end="3">
	                	<li>
	                    	<div class="article_img">
	                        	<img src="${item.aaddr}">
	                        </div>
	                        <div class="article_text">
	                        	<h2><a href="javascript:article(${item.aid})">${item.aname}</a></h2>
	                            <div class="writer">
	                                <span>作者:</span><a target="_blank" href="#">${item.aauthor}</a>
	                            </div>
	                            <div class="view_count">
	                                <span>${item.atime}</span>
	                            </div>
	                        </div>
	                    </li>
                   </c:forEach>
                    <%--<li>
                    	<div class="article_img">
                        	<img src="images/article_1.jpg">
                        </div>
                        <div class="article_text">
                        	<h2><a target="_blank" href="#">探索移情：为什么我爱你，你却不能爱我</a></h2>
                            <div class="writer">
                                <a target="_blank" href="#">刘月</a>
                            </div>
                            <div class="view_count">
                                <span>1911</span>
                            </div>
                        </div>
                    </li>
                    <li>
                    	<div class="article_img">
                        	<img src="images/article_1.jpg">
                        </div>
                        <div class="article_text">
                        	<h2><a target="_blank" href="#">探索移情：为什么我爱你，你却不能爱我</a></h2>
                            <div class="writer">
                                <a target="_blank" href="#">刘月</a>
                            </div>
                            <div class="view_count">
                                <span>1911</span>
                            </div>
                        </div>
                    </li>
                    <li>
                    	<div class="article_img">
                        	<img src="images/article_1.jpg">
                        </div>
                        <div class="article_text">
                        	<h2><a target="_blank" href="#">探索移情：为什么我爱你，你却不能爱我</a></h2>
                            <div class="writer">
                                <a target="_blank" href="#">刘月</a>
                            </div>
                            <div class="view_count">
                                <span>1911</span>
                            </div>
                        </div>
                    </li> --%>
                </ul>
            </div>
            <div id="showArticle_foot" style="bottom:20px;">
            	<p><a href="javaScript:getArticleInfo()" >更多文章...</a></p>
            </div>
        </div>
        <div id="userShuo" >
        	<div id="userShuo_head">
            	<h2>心情说</h2>
            </div>
            <div id="userShuo_body">
            	<ul class="index_user_say">
            		<c:forEach items="${moodInfo}" var="item" begin="0" end="5">
                    <li>
                        <h2><a href="javascript:mood(${item.mid})">${item.mname}</a></h2>
                        <h4>${item.mcontent}</h4>
                    </li>
                    </c:forEach>
                </ul>
            </div>
            <div id="userShuo_foot">
            	<p><a href="#">换一页</a></p>
            </div>
        </div>
        <div id="heartFM" style="margin-bottom:20px;">
        	<div id="heartFM_head">
            	<h2>听心理FM</h2>
            </div>
            <div id="heartFM_body">
            	<ul>
            	<c:forEach items="${fmArticleInfo}" var="item" begin="0" end="3">
                	<li>
                		<div class="FM_img">
                            <img src="${item.faddr}"/>
                            <a href="javascript:fm(${item.fid})" class="play"></a>
                        </div>
                        <h2><a href="javascript:fm(${item.fid})">${item.fname}</a></h2>
                        <div class="FM_author">
                            <span>作者：<b>${item.fauthor}</b></span>
                        </div>
                     </li>
                 </c:forEach>
                </ul>
            </div>
            	
            <div id="heartFM_foot">
            	<p><a href="javaScript:getInfo()">更多心理FM...</a></p>
            </div>
        </div>
      <!--  <div id="doTest">
        	<div id="doTest_head">
            	<h2>做测试</h2>
            </div>
            <div id="doTest_body">
            	<ul>
            	<!--<c:forEach items="${testInfo}" var="item" begin="0" end="3">
                	<li>
                        <div class="test_img">
                        	<a href="javascript:test(${item.tid})"><img src="${item.timg}" width="200" height="134"/></a>
                        </div>
                        <h2><a href="javascript:test(${item.tid})">${item.tname}</a></h2>
                        <div class="test_count">
                           	<span>0</span>
                        </div>
                	</li>
                </c:forEach>
                </ul>
            </div> 
            <div id="doTest_foot">
            	<p><a href="test/test.jsp">更多心理测试...</a></p>
            </div> 
        </div> -->
    </div>
    <div id="right">
        <div id="userInfo">
        	<c:choose>
        		<c:when test="${!empty sessionScope.currentUser }">
        			<div id="userInfo_1" style="background: #fff;">
        			<c:if test="${!empty userDetailInfo.upic}">
		            	<img src="../${sessionScope.userDetailInfo.upic }" style="height:72px;width:72px;border-radius:36px;border:1px solid #ccc;"/>
		            </c:if>
		            <c:if test="${empty userDetailInfo.upic}">
		            	<img src="images/userlogin.jpg" style="height:72px;width:72px;border-radius:36px;border:1px solid #ccc;"/>
		            </c:if>	
		                <div id="login_logo"><a href="userServlet?op=getPerInfo">${sessionScope.userDetailInfo.uname }</a></div>
		            </div>
		            <div id="userInfo_2">
		            	<dl>
		                    <dd>
		                        <a href="#">
		                            <h2>${sessionScope.moodNum }</h2>
		                            <h4>心情</h4>
		                        </a>
		                    </dd>
		                    <dd>
		                        <a href="#">
		                            <h2>0</h2>
		                            <h4>微笑</h4>
		                        </a>
		                    </dd>
		                </dl>
		            </div>
        		</c:when>
        		<c:otherwise>
	        		<div id="userInfo_1">
		            	<img src="images/userpic.jpg"/>
		                <div id="login_logo"><a href="login/login.html">登录</a></div>
		            </div>
		            <div id="userInfo_2">
		            	<dl>
		                    <dd>
		                        <a href="#">
		                            <h2>0</h2>
		                            <h4>心情</h4>
		                        </a>
		                    </dd>
		                    <dd>
		                        <a href="#">
		                            <h2>0</h2>
		                            <h4>微笑</h4>
		                        </a>
		                    </dd>
		                </dl>
		            </div>
        		</c:otherwise>
            </c:choose>
        </div>
        <div id="chatRoom">
        	<div id="chatRoom_head"><h2>心理互助平台</h2></div>
            <div id="chatRoom_body">
            	<ul>
                	<li>
                    	<a href="#">
                            <div class="chat_pic">
                                <img src="images/chat_1.jpg">
                            </div>
                            <div class="chat_text">
                            	<p>房间号：123</p>
                                <p>房间人数：123人</p>
                                <p>人数上限：200人</p>
                            </div>
                        </a>
                    </li>
                    <li>
                    	<a href="#">
                            <div class="chat_pic">
                                <img src="images/chat_2.jpg">
                            </div>
                            <div class="chat_text">
                            	<p>房间号：123</p>
                                <p>房间人数：123人</p>
                                <p>人数上限：200人</p>
                            </div>
                        </a>
                    </li>
                    <li>
                    	<a href="#">
                            <div class="chat_pic">
                                <img src="images/chat_3.jpg">
                            </div>
                            <div class="chat_text">
                            	<p>房间号：123</p>
                                <p>房间人数：123人</p>
                                <p>人数上限：200人</p>
                            </div>
                        </a>
                    </li>
                </ul>
            </div>
            <div id="chatRoom_foot">
            	<a href="chat/chat.html">改变,从心开始</a>
            </div>
        </div>
        <div id="getUs">
        	<div id="getUs_head">
            	<h2>订阅心理学</h2>
            </div>
        	<ul>
            	<li><a href="#" class="ico_email">邮箱</a></li>
                <li><a href="#" class="ico_weixin">微信</a></li>
                <li><a href="#" class="ico_tel">手机</a></li>
            </ul>
            
        </div>
    </div>
</div>
<!--内容部分结束-->
<div id="footer" >
  <div id="footer_content">
       	<div id="nav">
            <ul>
                <li><a href="#">关于我们</a></li>
                <li><a href="#">加入我们</a></li>
                <li><a href="#">联系我们</a></li>
                <li><a href="#">免责声明</a></li>
                <li><a href="#">友情链接</a></li>
                <li><a href="#">网站地图</a></li>
                <li><a href="#">手机版</a></li>
                <li><a href="#">手机应用</a></li>
                <li><a href="#" style="display: none">投稿</a></li>
            </ul>
        </div>
        <div id="links">
            <span>友情链接：</span>
            <ul>
                <li><a target="_blank" href="http://www.nlp.cn/">NLP心理学</a></li>
                <li><a target="_blank" href="http://zhidao.baidu.com/daily/">百度知道日报</a></li>
                <li><a target="_blank" href="http://iask.fh21.com.cn/">飞华问医生</a></li>
                <li><a target="_blank" href="http://www.dxsbb.com/">大学生网</a></li>
                <li><a target="_blank" href="http://yuwen.chazidian.com/">语文网</a></li>
                <li><a target="_blank" href="http://tag.120ask.com/"> 有问必答知识库</a></li>
                <li><a target="_blank" href="http://www.xinli001.com/zx/">心理咨询</a></li>
                <li><a target="_blank" href="http://wannianli.tianqi.com/">天气网</a></li>
                <li><a target="_blank" href="http://www.pm25.com/">绿色呼吸</a></li>
                <li><a target="_blank" href="http://www.vmovier.com/">V电影</a></li>
                <li><a target="_blank" href="http://iask.sina.com.cn/c/79.html ">爱问健康</a></li>
            </ul>
        </div>
        <div id="copyright">
            <div id="footer_1">
                &copy; 2015 All Rights Reserved. <a target="_blank" href="http://www.miibeian.gov.cn/">粤ICP备12051153号</a>
            </div>
            <div id="footer_2">
                <a href="#">
                    <img src="images/footer_pic1.png" align="absmiddle" />
                </a>
                <a href="#">
                    <img src="images/footer_pic2.png" align="absmiddle" />
                </a>
            </div>
        </div>
    </div>
</div>
</body>
</html>

